<?php
namespace app\usercp\controller;

use app\usercp\exception\UsercpException;
use think\Controller;
use think\facade\Request;

class Usercp extends Controller
{

    protected $custom;
    protected $page;
    protected $limit;

    protected function initialize()
    {
        $this->page = Request::get('page',0);
        $this->limit = Request::get('limit',12);
        // 判断用户是否登陆
        $this->custom = model('custom/custom','service')->validate_token(cookie('account_token'));
        if (empty($this->custom['id']) || $this->custom['status'] == -1){
            $this->redirect('login/index');
        }
        // 获取节点树
        $nodes = model('usercp/node','service')->node_tree();
        $this->assign('nodes',$nodes);
        $this->assign('custom',$this->custom);
    }
}